package com.itzgyw.example.controller;

import lombok.Data;

import java.io.Serializable;

/**
 * @Auther: Mr. Zeng
 * @Date: 2020/12/10 17:46
 * @Description: 暂无描述
 */
@Data
public class ResultModel<T> implements Serializable {
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 描述信息
     */
    private String msg;
    /**
     * 返回数据
     */
    private T data;


    public ResultModel() {
    }

    public ResultModel(Integer code, String msg) {
        this.msg = msg;
        this.code = code;
    }

    public boolean onNull() {
        return this.data == null;
    }


    public ResultModel<T> flashData(T data) {
        this.data = data;
        return this;
    }

    public ResultModel<T> flashMessage(String msg) {
        this.msg = msg;
        return this;
    }

}
